import request from './http'
export function getBillList(type,size=6,offset=0){
    const url=`/api/v1/restserver/ting/baidu.ting.billboard.billList?method=baidu.ting.billboard.billList&type=${type}&size=${size}&offset=${offset}`
        return request.get(url).then(res=>{
            return {
                ...res,
                list:res.song_list
            }
    })
}
// export function getMusicDetail(songId){
//     const url=`/api/v1/restserver/ting/baidu.ting.billboard.billList?method=baidu.ting.billboard.billList&type=${this.type}&size=${this.size}&offset=0`
//     return request.get(url)
//         }
function getSongList(type,size=6,offset=0){
    const url=`/api/v1/restserver/ting/baidu.ting.billboard.billList?method=baidu.ting.billboard.billList&type=${type}&size=${size}&offset=${offset}`
    return request.get(url)
}
function getMusicPlay(songid){
    let url=`/api/v1/restserver/ting?method=baidu.ting.song.play&songid=${songid}`
    return request.get(url)
}
function getSinger(limits,tinguid){
    let url=`/api/v1/restserver/ting?method=baidu.ting.artist.getSongList&limits=${limits}&tinguid=${tinguid}`
    return request.get(url)
}
function getSearch(query){
    let url=`/api/v1/restserver/ting?method=baidu.ting.search.catalogSug&query=${query}`
    return request.get(url)
}
export {getSongList,getMusicPlay,getSinger,getSearch}